﻿using System;

using Preactor.ObjectModel.Attributes;
using Preactor.ObjectModel.Entities;
using Preactor.ObjectModel.Interfaces;

namespace Preactor.ObjectModel.BaseTypes
{
    public class Product : PreactorRecord, IProduct
    {
        #region Implementation of IProduct

        [PreactorField("FAMILY", FieldDeclarationType.FieldClassification)]
        public string ParentPart { get { return (string)GetValue("ParentPart"); } set { SetValue("ParentPart", value); } }

        [PreactorField("OPERATION NUMBER", FieldDeclarationType.FieldClassification)]
        public int OperationNumber { get { return (int)GetValue("OperationNumber"); } set { SetValue("OperationNumber", value); } }

        [PreactorField("LIKE TO LIKE SETUP", FieldDeclarationType.FieldClassification)]
        public TimeSpan LikeToLikeSetupTime { get { return (TimeSpan)GetValue("LikeToLikeSetupTime"); } set { SetValue("LikeToLikeSetupTime", value); } }

        [PreactorField("LIKE TO LIKE MATCH", FieldDeclarationType.FieldClassification)]
        public String LikeToLikeMatch { get { return (String)GetValue("LikeToLikeMatch"); } set { SetValue("LikeToLikeMatch", value); } }

        [PreactorField("MAX OPERATION SPAN", FieldDeclarationType.FieldClassification)]
        public Double MaximumOperationSpan { get { return (Double)GetValue("MaximumOperationSpan"); } set { SetValue("MaximumOperationSpan", value); } }

        [PreactorField("SEQ SLACK", FieldDeclarationType.FieldClassification)]
        public TimeSpan SlackTime { get { return (TimeSpan)GetValue("SlackTime"); } set { SetValue("SlackTime", value); } }

        #endregion

        protected Product(PrimaryKey id, PreactorObjectModel preactorObjectModel)
            : base(id, preactorObjectModel)
        {
        }

        public override string ToString()
        {
            return string.Format("Type: Product, Format Name: {0}, PK: {1}", base.FormatName, base.Id.Value);
        }
    }
}
